import React, { useState } from 'react'

const useNumValue = () => {
  const [value,setValue] = useState("")
  const onChange = (e)=>{
    setValue(e.target.value)
  } 

  const err = /^\d+$/.test(value) || !value ? "":"请输入数字"
  
  return {err,value,onChange}
}

export default useNumValue